A5Storage::SecurityImpersonation RemoveRemoteServer Method
Syntax
.RemoveRemoteServer as System::Void ([ShareName as C, ] ForceDisconnect as L = .t.)
Arguments
- ShareNameCharacter
The name assigned as the server and share name when adding the remote server in the format \\ServerName\ShareName.
If you omit the ShareName, the function will remove the last sharename connected with the current instance of the object. if you have not added a remote server with this instance and you omit the share name, an error will be returned.- ForceDisconnectLogical
When set to true, this parameter will force all open files to be closed. Otherwise the share will be disconnected when the last file closes.
Description
Removes a remote network share from the local Windows Session and User so it is no longer available..
Example
dim Sec as A5Storage::SecurityImpersonation dim Server as c = "ec2-3-91-243-228.compute-1.amazonaws.com" Dim ShareName as C = "myshare" dim Domain as C = "sgw-6FC21806" dim User as C = "smbguest" dim Password as C = "xxxxxxxx" dim UseName as C = "\\\" + Server + "\\" + ShareName Sec.AddRemoteServerDomain(Domain, Server, User, Password, ShareName) ?Sec.CallResult.text s = FILE.To_String(UseName + "\test\source\foo.txt") ?s Sec.RemoveRemoteServer(.t.) or Sec.RemoveRemoteServer(UseName, .t.)
Windows does does not close the share immediately. There can be a delay of anywhere from 10 to 30 seconds before the share becomes invalid.
You do not have to wait for this to happen as the function will return immediately.